home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Modem / Supra Scripts Folder / Supra Fax2&ARA < prev    next >
Text File  |  1993-01-28  |  6KB  |  273 lines

  1. !
  2. ! LineShare™ Script for Supra v32bis data-fax modems
  3. ! This script is designed for Class 2 fax software and -
  4. ! ••• Make sure that you have "H" or better ROMs in your modem!
  5. !
  6. ! If you want to modify this script for your modem, pay attention to
  7. ! the line marked "#### Settings ####" - it should be modified first
  8. ! This script is written to use with ARA on the "Data" subPort, so
  9. ! the modem is set to the "no correction/compression" mode
  10. !
  11.  
  12. ! ------------------------------------------
  13. ! Resetting the modem:
  14. ! ------------------------------------------
  15. @Hangup
  16.   SetTries 2
  17.   Flush
  18.   HsReset 0,0,17,19,0,0
  19. !
  20. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  21. ! to enter the command mode
  22. !
  23. @Label 1
  24.   matchclr
  25.   matchstr 1 2 "OK\r\n"
  26.   write "ATH0&F1\r"
  27.   matchread 20
  28.   Write "+++"
  29.   DtrClear
  30.   pause 10
  31.   DtrSet
  32. !
  33.   DecTries
  34.   IfTries 0 1
  35. !
  36. ! OSErr -6019 "Modem error - the modem is not responding"
  37. !
  38.   exit -6019
  39. @Label 2
  40.   write "AT+FCLASS=0\r"
  41.   Jsr 100
  42.   write "AT+FAA=0\r"
  43.   Jsr 100
  44.   exit 0
  45. ! ------------------------------------------
  46. !    Receiving incoming calls
  47. ! ------------------------------------------
  48. @ANSWER
  49. @Label 10
  50. !
  51. ! Set the modem preferred speed first
  52. !
  53.   SERRESET 2400,0,8,1
  54.   Jsr 80
  55. !
  56. ! Set the common options
  57.   Jsr 70
  58. !
  59. ! Set the communication options:
  60. ! • X4:  Extended response set
  61. ! • N1: Connect at the highest rate
  62. ! • \N1: Direct connection (for ARA)
  63. ! • &K4: Xon/Xoff flow control (for Fax)
  64. ! • W2:  report connection speed
  65. !
  66. @Label 11
  67. ! #### Settings - change this according to the type of modem you have ####
  68.   Write "ATX4N1\\N1&K4W2\r"
  69.   Jsr 100
  70. !
  71. ! Set the "work" speed
  72. !
  73. @Label 12
  74.   SERRESET 19200,0,8,1
  75.   Jsr 80
  76. !
  77. ! Set Fax parameters: LID, DCC,BOR
  78. !
  79.   Write "AT+FCLASS=2\r"
  80.   Jsr 100
  81.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  82.   Jsr 100
  83.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  84.   Jsr 100
  85.   Write "AT+FBOR=1\r"
  86.   Jsr 100
  87. !
  88. ! Allow modem to receive fax messages
  89. !
  90.   Write "AT+FCR=1\r"
  91.   Jsr 100
  92. !
  93. ! Tell the modem to determine the type of the incoming call
  94. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  95. !
  96.   Write "ATS0=^4+FAA=1\r"
  97.   Jsr 100
  98. !
  99. ! Everything is ready - let's sit and wait for a call
  100. ! We'll wait for 2 minutes, then reinitiate the modem
  101. !
  102. @Label 20
  103.   MatchClr
  104.   matchstr 1 20 "RING\r\n"
  105.   matchstr 2 21 "\r\nCONNECT"
  106.   matchstr 3 24 "\r\n+FCON"
  107.   matchstr 4 10 "\r\nNO "
  108.   matchstr 5 10 "\r\nBUSY"
  109.   Matchread 1200
  110.   jump 10
  111. !
  112. ! Data connection has been established (we read "CONNECT")
  113. ! Put the "CONNECT" back to the buffer and attach the "Data" subPort
  114. ! if it was an incoming call, put the "RING" before the "CONNECT"
  115. !
  116. @Label 21
  117.   LogMsg "Data call…"
  118.   QueueInput "\r\nCONNECT"
  119.   ifOriginate 22
  120.   QueueInput "\r\nRING\r\n"
  121. @Label 22
  122.   Attach "Data" (DTR,Escape,TimeLimit=0)
  123. !
  124. ! Fax connection has been established (we read "+FCON")
  125. ! Put the +FCON back to the buffer,
  126. ! if it was an incoming call, put the "RING" before the "+FCON"
  127. ! Attach the "Fax" subPort
  128. !
  129. @Label 24
  130.   QueueInput "\r\n+FCON"
  131.   ifOriginate 25
  132.   QueueInput "\r\nRING\r\n"
  133. @Label 25
  134.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  135. ! ------------------------------------------
  136. ! Originating a call through the "Data" subport
  137. ! ------------------------------------------
  138. @ORIGINATE "Data"
  139. !
  140. ! Set the Data speed
  141. !
  142.   SERRESET 19200,0,8,1
  143.   Jsr 80
  144. !
  145. ! Set the common options
  146. !
  147.   Jsr 70
  148. !
  149. ! Set the Data mode:
  150. ! • X4:  Extended response set
  151. ! • N1: Connect at the highest rate
  152. ! • \N1: Direct connection (no compression, correction - for ARA)
  153. ! • &S1: DSR according to CCITT (if the cable connects CTS with DSR, not DCD)
  154. ! • S7:  time-out (90 sec) for long-distance call (if you use them)
  155. !
  156. ! #### Settings - change this according to the type of modem you have ####
  157.   Write "ATX4N1\\N1&S1S7=90\r"
  158.   Jsr 100
  159. !
  160. ! Now emit all commands that the application has sent to that port
  161. ! (if we use ARA/LineShare script, no commands were sent)
  162. !
  163.   Jsr 60
  164. !
  165. ! Prepare to receive all error result codes
  166. !
  167.   Jsr 90
  168.   matchstr 1 21 "\r\nCONNECT"
  169. !
  170. ! Dial the number
  171. !
  172.   HsReset *
  173.   Write "ATD^1\r"
  174.   MatchRead 900
  175.   Write "\r"
  176.   Exit -6019
  177. ! ------------------------------------------
  178. ! Originating a call through the "Fax" subPort
  179. ! ------------------------------------------
  180. @ORIGINATE "Fax" ("\r\nLineShare Line is Busy\r\nNO DIALTONE\r\n")
  181. !
  182. ! Set the "Fax" speed
  183. !
  184.   SERRESET 19200,0,8,1
  185.   Jsr 80
  186. !
  187. ! Set the common options
  188. !
  189.   Jsr 70
  190. !
  191. ! Set the Fax mode
  192. ! &S0: DSR always on (see above)
  193. !
  194.   Write "AT&S0+FCLASS=2\r"
  195.   Jsr 100
  196. !
  197. ! Now emit all commands that the application has sent to that port,
  198. ! Prepare to receive all error result codes
  199. !
  200. @LABEL 50
  201.   Jsr 60
  202.   Jsr 90
  203.   MatchStr 1 24 "\r\n+FCON"
  204.   HsReset *
  205.   Write "ATD^1\r"
  206.   MatchRead 700
  207.   Write "\r"
  208.   Exit -6019
  209. !
  210. ! This section emits all modem commands sent from the client application
  211. ! For each set of commands the "OK" answer is awaited
  212. !
  213. @Label 60
  214.   EmitStart
  215. @Label 61
  216.   EmitCommand 62
  217.   Jsr 100
  218.   Jump 61
  219. @Label 62
  220.   return
  221. !
  222. ! This section initiates the modem before ANSWER and ORIGINATEs:
  223. ! factory settings + speaker control +
  224. ! reset on Dtr drop + DCD valid
  225. ! Verbal responses mode, no echo 
  226. !
  227. @Label 70
  228.   Write "ATM^2L^3&D3&C1V1E0\r"
  229.   Jsr 100
  230.   return 
  231. !
  232. ! This section syncronize the modem after the serial port speed switching
  233. !
  234. @Label 80
  235.   ChrDelay 1
  236.   Write "AT\r"
  237.   ChrDelay 0
  238.   Jsr 100
  239.   return
  240. !
  241. ! Prepare to receive error result codes
  242. !
  243. @Label 90
  244.   MatchClr
  245.   MatchStr 2 91 "NO DIALTONE\r\n"
  246.   MatchStr 3 92 "BUSY\r\n"
  247.   MatchStr 4 93 "NO CARRIER\r\n"
  248.   MatchStr 5 94 "NO ANSWER\r\n"
  249.   return
  250. @Label 91
  251.   exit -6020
  252. @Label 92
  253.   exit -6022
  254. @Label 93
  255.   exit -6021
  256. @Label 94
  257.   exit -6023
  258. !
  259. ! Processing the AT command:
  260. ! OK -> proceed
  261. ! ERROR or TimeOut ->exit -6019
  262. ! It can be called AFTER the "Write" command, since LineShare buffers input
  263. !
  264. @Label 100
  265.   MatchClr
  266.   MatchStr 1 102 "\r\nOK\r\n"
  267.   MatchStr 2 101 "\r\nERROR\r\n"
  268.   MatchRead 20
  269. @Label 101
  270.   Exit -6019
  271. @Label 102
  272.   return
  273.